<?php
class TeamDropdown extends Dropdown
{
	function __construct($name, $value)
	{
		parent::__construct($name, (int)$value);
		
		$query = "SELECT Team.nefub_id, CONCAT(Team.name, ' (', Competition.name, ')') as name
					FROM Team
					LEFT JOIN Competition ON Team.competition_nefub_id = Competition.nefub_id
					ORDER BY Team.name ASC, Competition.name ASC";
		$rows = Database::select_rows_by_query($query);
		$this->addOption('Geen', 0);
		
		foreach ($rows as $row)
		{
			$this->addOption($row['name'], $row['nefub_id']);
		}
	}
}